package com.fr.data.util.function;

public abstract class AbstractDataFunction
  implements DataFunction
{
  public static final int NULL = 0;
  public static final int SUM = 1;
  public static final int COUNT = 2;
  public static final int AVERAGE = 3;
  public static final int MAX = 4;
  public static final int MIN = 5;
  public static final int NONE = 6;

  public static DataFunction createDataFunction(int paramInt)
  {
    switch (paramInt)
    {
    case 1:
      return new SumFunction();
    case 2:
      return new CountFunction();
    case 3:
      return new AverageFunction();
    case 4:
      return new MaxFunction();
    case 5:
      return new MinFunction();
    case 6:
      return new NoneFunction();
    }
    return null;
  }

  public static int createDataFunctionIndex(DataFunction paramDataFunction)
  {
    if (paramDataFunction instanceof SumFunction)
      return 1;
    if (paramDataFunction instanceof CountFunction)
      return 2;
    if (paramDataFunction instanceof AverageFunction)
      return 3;
    if (paramDataFunction instanceof MaxFunction)
      return 4;
    if (paramDataFunction instanceof MinFunction)
      return 5;
    if (paramDataFunction instanceof NoneFunction)
      return 6;
    return 0;
  }

  public boolean equals(Object paramObject)
  {
    if ((paramObject == null) || (!(paramObject instanceof AbstractDataFunction)))
      return false;
    return super.getClass().equals(paramObject.getClass());
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    AbstractDataFunction localAbstractDataFunction = (AbstractDataFunction)super.clone();
    localAbstractDataFunction.reset();
    return localAbstractDataFunction;
  }
}